#include "officeFactory.h"
#include "ExcelBinaryFile.h"
#include "WordBinaryFile.h"
#include "PowerPointBinaryFile.h"
#include "WordOOXMLFile.h"
#include "PowerPointOOXMLFile.h"
#include "ExcelOOXMLFile.h"
#include "IOfficeFile.h"

officeFactory::officeFactory()
{
	
}


officeFactory::~officeFactory()
{
}

IOfficeFile* officeFactory::CreateOfficeFile(string filePath)
{
	string cut = filePath.substr(filePath.find_last_of(".") + 1);
	string suffix = _strlwr((char*)cut.c_str());
	if (suffix == "xls")
	{
		
		return new ExcelBinaryFile(filePath);
	}
	else if (suffix == "doc")
	{
		return new WordBinaryFile(filePath);
	}
	else if (suffix == "ppt")
	{
		return new PowerPointBinaryFile(filePath);
	}
	else if (suffix == "docx")
	{
		return new WordOOXMLFile(filePath);
	}
	else if (suffix == "pptx")
	{
		return new PowerPointOOXMLFile(filePath);
	}
	else if (suffix == "xlsx")
	{
		return new ExcelOOXMLFile(filePath);
	}
	else
	{
	
		return NULL;
	}
	
}
